package com.example.zhihuhelpapp.activity;

import android.app.Activity;
import android.content.Intent;
import android.text.TextUtils;

import com.example.zhihuhelpapp.R;
import com.example.zhihuhelpapp.base.MyBaseRxActivity;
import com.example.zhihuhelpapp.mvp.UserAnswerListPresenter;
import com.example.zhihuhelpapp.mvp.contract.IUserAnswerListContract;
import com.example.zhihuhelpapp.utils.LogUtils;

public class UserAnswerListActivity extends MyBaseRxActivity<UserAnswerListPresenter> implements IUserAnswerListContract.IView {
    public static final String KEY_USER_ID = "key_user_id";
    private String userId;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_user_answer_list;
    }

    @Override
    protected void initView() {

    }

    @Override
    protected void initData() {
        super.initData();
        if (getIntent().hasExtra(KEY_USER_ID)) {
            userId = getIntent().getStringExtra(KEY_USER_ID);
        }
        if (TextUtils.isEmpty(userId)) {
            userId = "";
        }
        LogUtils.i("当前用户id："+userId);
        mPresenter.getUserAnswerList(userId);
    }

    @Override
    protected UserAnswerListPresenter createPresenter() {
        return new UserAnswerListPresenter();
    }

    public static void startPage(Activity activity,String userId){
        Intent intent = new Intent(activity,UserAnswerListActivity.class);
        intent.putExtra(KEY_USER_ID,userId);
        activity.startActivity(intent);
    }
}
